<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
include_once "Aluno.php";
include_once "Professor.php";
include_once "TipoPapel.php";
include_once "TIpoRelatorio.php";
include_once "../model/dao/DBRelatorio.php";
include_once "../model/dao/DBAluno.php";
include_once "AlunoExpectador.php";

/**
 * Description of ListaDePresenca
 *
 * @author gabrielbmoro
 */
class ListaDePresenca {

    private $dataAtual;
    private $hora;
    private $alunoExpectador;
    private $alunoOrientado;
    private $professorCoordenador;
    private $dbRelatorio;
    private $dbAluno;

    public function __construct($disciplina, $nomeCoordenador, $curso, $anoSemestre, $dataAtual, $hora, $nomeDoAluno, $matricula) {
        $this->alunoOrientado= new Aluno(null, null, null, $nomeDoAluno);
        $this->alunoExpectador = new AlunoExpectador($matricula, $dataAtual, $anoSemestre);
        $temp = new TipoPapel();
        $this->professorCoordenador = new Professor($temp->getCOORDENADOR_TCC(), null, null, null, null, null, $nomeCoordenador, null);
        $this->dataAtual = $dataAtual;
        $this->hora = $hora;
        $tmp = new TipoRelatorio();
        $this->dbRelatorio = new DBRelatorio($tmp->getForm_Lista_Presenca());
        $this->dbAluno = new DBAluno();
    }

    public function registrarListaDePresenca() {
        if ($this->dataAtual != null && $this->hora != null && $this->alunoExpectador != null && $this->professorCoordenador != null &&
                $this->dbRelatorio != null && $this->dbAluno != null) {
            $idAluno = $this->dbAluno->recuperaIdAluno($this->alunoOrientado->getNome());
            $valores = $idAluno . "," . $this->alunoExpectador->getMatricula() .
                    "," . "\"$this->dataAtual\"" .
                    "," . "\"$this->hora\"" . ",\"" .
                    $this->alunoExpectador->getAnoSemestre() . "\"";

            return $this->dbRelatorio->inserir($valores);
        }
    }

}
